<?php

$db = mysql_connect('localhost', 'revealweb', 'r3v34ls3cr3t') or die();
mysql_select_db('reveal_titles');

$fileName = '';

if (isset($_GET['file'])) {
  $fileName = mysql_real_escape_string($_GET['file']);
}

$titles = mysql_query("select title_name from titles where title_filename like '$fileName%'");

if ($titles && mysql_num_rows($titles) > 0) {
  $title = mysql_fetch_assoc($titles);
  echo $title['title_name'];
  exit();
} else {
  die();
}
?>
